package com.sky.task;

import com.sky.webSocket.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


@Component
@Slf4j
public class MyTask {

    @Autowired
    WebSocketServer webSocketServer;

    @Scheduled(cron = "0/5 * * * * ? ")
    public void task() {
        log.info("定时任务开始触发");
        webSocketServer.sendToAllClient("发给你");
    }
}